<!-- 订单详情 -->
<template>
	<view>
		<view class="state-box ss-flex ss-row-center ss-col-center" :style="[
		    {
		      marginTop: '-' + Number(statusBarHeight + 88) + 'rpx',
		      paddingTop: Number(statusBarHeight + 88) + 'rpx',
		    },
		  ]">
			<view class="steps-box">
				<view class="steps-item" :class="{active: state.orderInfo.status != 4 && state.orderInfo.status > index}"
					v-for="(item, index) in options" :key="index">
					<view class="steps-item-link"></view>
					<view class="steps-item-text">
						{{ item }}
					</view>
				</view>
			</view>
		</view>
		<view class="container">
			<view class="card info-box">
				<text class="label">系统单号：</text>
				<text class="value">{{ state.orderInfo.shopbill }}</text>
				<text class="copy" @tap.stop="copy" :data-text="state.orderInfo.shopbill">复制</text>
			</view>
			<view class="card order-box">
				<view class="head-box">
					<view class="brand">
						{{ state.orderInfo.channelSubTag }}
					</view>
					<view class="order" v-if="state.orderInfo.waybill">
						运单号：<text class="number">{{ state.orderInfo.waybill }}</text>
					</view>
					<view v-if="state.orderInfo.waybill" class="copy" @tap.stop="copy" :data-text="state.orderInfo.waybill">
						复制
					</view>
					<view class="order" v-else>{{state.orderInfo.nowaybill}}</view>
				</view>
				<view class="sending">
					<view class="icon">寄</view>
					<view class="ss-flex-col ss-flex-1">
						<text class="basic">{{ state.orderInfo.sender }} {{ state.orderInfo.senderMobile }}</text>
						<text class="address">{{ state.orderInfo.senderAddress }}</text>
					</view>
					<view class="copy" @tap.stop="copy" :data-text="state.orderInfo.sender+' '+state.orderInfo.senderMobile+' '+state.orderInfo.senderAddress">复制</view>
				</view>
				<view class="receiving">
					<view class="icon">收</view>
					<view class="ss-flex-col ss-flex-1">
						<text class="basic">{{ state.orderInfo.receiver }} {{ state.orderInfo.receiverMobile }}</text>
						<text class="address">{{ state.orderInfo.receiveAddress }}</text>
					</view>
					<view class="copy" @tap.stop="copy" :data-text="state.orderInfo.receiver+' '+state.orderInfo.receiverMobile+' '+state.orderInfo.receiveAddress" >复制</view>
				</view>
			</view>
			<view class="card info-box" v-if="state.orderInfo.courierName">
				<text class="label">快递员：</text>
				<text class="value">姓名：{{ state.orderInfo.courierName }} / 电话：{{ state.orderInfo.courierPhone }}</text>
				<text class="cicon-phone-call" @click="callphone(state.orderInfo.courierPhone)"></text>
				<text class="copy" @tap.stop="copy" :data-text="state.orderInfo.courierPhone">复制</text>
			</view>
			<view class="card info-box" v-if="state.orderInfo.jijianma">
				<text class="label">寄件码：</text>
				<text class="value" style="font-weight: 600;">{{ state.orderInfo.jijianma }}</text>
				<text class="copy" @tap.stop="copy" :data-text="state.orderInfo.jijianma">复制</text>
				<view class="tips">
					可将寄件码写在包裹上，防止快递员拿错
				</view>
			</view>
			<view class="card information">
				<view class="title">
					寄件信息
				</view>
				<view class="column">
					<uni-row>
						<uni-col :span="12">
							<view class="demo-uni-col">寄件物：{{ state.orderInfo.itemName }}</view>
						</uni-col>
						<uni-col :span="12">
							<view class="demo-uni-col">包裹数：{{ state.orderInfo.packageCount }}</view>
						</uni-col>
					</uni-row>
					<uni-row>
						<uni-col>
							<view class="demo-uni-col">
								预约时间：{{ state.orderInfo.pickupStartTime }}--{{ state.orderInfo.pickupStopTime }}
							</view>
						</uni-col>
					</uni-row>
					<uni-row>
						<uni-col :span="12">
							<view class="demo-uni-col">下单重量：{{ state.orderInfo.weight }}KG</view>
						</uni-col>
						<uni-col :span="12">
							<view class="demo-uni-col">下单体积：{{ state.orderInfo.volume }}CM</view>
						</uni-col>
					</uni-row>
					<uni-row>
						<uni-col :span="12">
							<view class="demo-uni-col">
								实际体积：-
							</view>
						</uni-col>

						<uni-col v-if="state.orderInfo.calWeight>0" :span="12">
							<view class="demo-uni-col">实际重量：{{ state.orderInfo.calWeight }}KG</view>
						</uni-col>
					</uni-row>
				</view>
				<view class="column">
					<uni-row>
						<uni-col>
							<view class="demo-uni-col">
								下单时间：{{ state.orderInfo.createTime }}
							</view>
						</uni-col>
					</uni-row>
					<uni-row>
						<uni-col>
							<view class="demo-uni-col red">
								下单金额：¥{{ state.orderInfo.money }}
							</view>
						</uni-col>
					</uni-row>
					<uni-row>
						<uni-col>
							<view class="demo-uni-col red">
								订单状态：{{ state.orderInfo.type }}
							</view>
						</uni-col>
					</uni-row>
				</view>
			</view>
			<view class="card information">
				<view class="title">
					运单轨迹
				</view>
				<view class="column">
					<view class="time-node" v-for="(item, index) in state.guiji" :key="index">
						<!-- <view class="time">
							<view class="dot"></view>
						</view> -->
						<view class="content">
							{{ item }}
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	var app = getApp();
	export default {
		data() {
			return {
				statusBarHeight: 40,
				options: ['取件中', '运输中', '派件中', '已签收'],
				state: {
					orderInfo: {
						jijiancg: '',
						facity: '南昌市',
						fuser: '王先生',
						jaddress:'江西省南昌市青山湖区麻丘镇',
						jmobile: '18146629147',
						shoucity: '上海市',
						suser: '李四毛',
						saddress:'上海市黄浦区外滩16号',
						smobile: '18146629148',
						order_sn: '33430548',
						create_time_text: '2024年5月23日21:25:35',
						zhongl: '10',
						shijzl: '12',
						chaj: '8',
						jijianm:85268,
						wupin:'化妆品',
						shuliang:'1',
						yuyueshjstart:'2024年5月21日22:33:54',
						yuyueshjstop:'2024年5月23日22:34:03',
						tiji:'1',
						zhongliang:12
					},
					guiji: [
						
					]
				}
			};
		},
		onLoad: function(opt) {
			if(opt && opt.id){
				this.state.orderInfo.id = opt.id
				this.getDateInfo()
			}
			
		},
		methods: {
			getDateInfo() {
				let that = this;
				app.post('ApiKuaidi/kuaidiDateilInfo', {
					id:that.state.orderInfo.id
				}, function(res) {
					app.showLoading(false);
					that.loading = false;
					if (res.code == 1) {
						that.state = res.date
					}else{
						app.error(res.msg);
						setTimeout(function(){
							uni.navigateBack()
						},2000)
					}
					that.loaded();
				});
			},
		}
	};
</script>
<style lang="scss" scoped>
	.state-box {
		--color: rgba(255, 255, 255, 0.9);
		width: 100%;
		height: 340rpx;
		background: linear-gradient(to bottom, #0396ff, #6075f1);
		background-size: 750rpx 100%;
		box-sizing: border-box;

		.steps-box {
			width: 80%;
			display: flex;
			justify-content: space-between;
			align-items: center;

			.steps-item {
				display: flex;
				flex-direction: column;
				align-items: center;
				row-gap: 30rpx;

				&.active {
					--color: #42b983;
				}

				&-link {
					position: relative;
					height: 24rpx;
					width: 24rpx;
					border-radius: 50%;
					background-color: var(--color);

					&::after {
						content: '';
						width: 128rpx;
						border-bottom: 2rpx dashed var(--color);
						position: absolute;
						top: 50%;
						left: 140%;
					}
				}

				&:last-child .steps-item-link::after {
					display: none;
				}

				&-text {
					color: var(--color);
				}
			}
		}
	}

	.container {
		--theme-color: #0396ff;
		padding: 20rpx;

		.card:not(:first-child) {
			margin-top: 20rpx;
		}

		.info-box {
			padding: 28rpx;

			.label {
				font-size: 30rpx;
				color: #999999;
			}

			.value {
				font-size: 30rpx;
				color: #000;
			}

			.cicon-phone-call {
				margin: 0 16rpx;
				font-size: 32rpx;
			}

			.tips {
				margin-top: 20rpx;
				font-size: 24rpx;
				color: #999999;
			}
		}

		.copy {
			color: var(--theme-color);
			font-size: 28rpx;
			margin-left: 10rpx;
		}

		.order-box {
			.head-box {
				display: flex;
				align-items: center;
				padding: 20rpx;
				font-size: 30rpx;
				column-gap: 20rpx;
				border-bottom: 2rpx solid #eeeeee;

				.brand {
					width: 120rpx;
					height: 68rpx;
					line-height: 68rpx;
					border-radius: 34rpx;
					background-color: #ea883f;
					text-align: center;
					color: #fff;
				}

				.order {
					color: #2c2c2c;

					.number {
						color: #ff6600;
					}
				}
			}

			.sending,
			.receiving {
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 36rpx 0;

				.icon {
					width: 64rpx;
					height: 64rpx;
					text-align: center;
					line-height: 64rpx;
					border-radius: 50%;
					font-size: 32rpx;
					margin: 0 44rpx;
					color: #fff;
				}

				.basic {
					color: #000;
					font-size: 32rpx;
					font-weight: 600;
					margin-bottom: 10rpx;
				}

				.address {
					font-size: 28rpx;
					color: #9d9d9d;
				}

				.copy {
					margin: 0 36rpx;
				}
			}

			.sending .icon {
				background-color: #0396ff;
			}

			.receiving .icon {
				background-color: #000000;
			}
		}

		.information {
			padding: 40rpx 30rpx;

			.title {
				margin: 12rpx 0;
			}

			.column {
				color: #999999;
				font-size: 28rpx;
				padding: 20rpx 0;
				border-bottom: 2rpx solid #eeeeee;

				:deep(.uni-row) {
					padding: 8rpx 0;
				}

				.time-node {
					margin-bottom: 20rpx;

					.time {
						display: flex;
						align-items: center;
						font-size: 30rpx;
						color: #000;
						padding: 10rpx 0;

						.dot {
							width: 24rpx;
							height: 24rpx;
							background-color: #000;
							border-radius: 50%;
							margin: 0 10rpx;
						}
					}

					.content {
						line-height: 44rpx;
					}
				}
			}
		}

		.title {
			font-size: 30rpx;
			color: #000;
			font-weight: 600;
		}

		.red {
			color: red;
		}
	}
	.ss-row-center {
	    justify-content: center;
	}
	.ss-col-center {
	    align-items: center;
	}
	.ss-flex {
	    display: flex;
	    flex-direction: row;
	    align-items: center;
	}
	.card {
	    border-radius: 20rpx;
	    background-color: #fff;
	}
	.ss-flex-col {
	    display: flex;
	    flex-direction: column;
	}
	.ss-flex-1 {
	    flex: 1;
	}
	.container .information .column.data-v-6b23c96c .uni-row {
    padding: 8rpx 0;
}
</style>